package com.shaozg.studydemo.advanced_control_activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.shaozg.studydemo.R;

public class ListViewActivity extends Activity implements OnClickListener {
	private Button mSimpleLVBtn;
	private Button mSimpleAdapterBtn;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_list_view);
		
		mSimpleLVBtn = (Button)findViewById(R.id.simple_lv_btn);
		mSimpleLVBtn.setOnClickListener(this);
		
		mSimpleAdapterBtn = (Button)findViewById(R.id.simple_adapter_lv_btn);
		mSimpleAdapterBtn.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.list_view, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		int id = v.getId();
		Intent intent = new Intent();
		
		switch (id) {
		case R.id.simple_lv_btn:
			intent.setClass(this, SimpleLVActivity.class);
			startActivity(intent);
			break;
		case R.id.simple_adapter_lv_btn:
			intent.setClass(this, SimpleAdaterLVActivity.class);
			startActivity(intent);
			break;
		default:
			break;
		}
	}
}
